package com.gc.server.controller;

import com.yf.utils.GenUtils;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.sql.SQLException;

@RestController
public class TestController {

    @RequestMapping("/")
    public String test(){
        return "power by yf";
    }

    public static void main(String[] args) {
        String jdbcUrl = "jdbc:mysql://localhost:3306/gc?serverTimezone=CTT";
        String userName = "root";
        String password = "19941220";
        String packageName = "com.gc.server";
        String filePath = "/Users/huangfei/Desktop/autoCode.zip";
        try {
            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).generatorCode(null);
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("bus_apply").alias("apply").join("user").alias("user").on("apply.user_id","user.id").generateVoCode();
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("user").alias("user").join("user").alias("top").on("user.pid","top.id").join("level").alias("level").on("user.level_id","level.id").generateVoCode();
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("img_order").alias("imgOrder").join("user").alias("shop").on("shop.id","imgOrder.shop_id").join("user").alias("user").on("user.id","imgOrder.user_id").generateVoCode();
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("goods_apply").alias("apply").join("user").alias("user").on("user.id","apply.user_id").generateVoCode();
//            GenUtils.init(jdbcUrl, userName, password, filePath,packageName).table("bus_apply").alias("apply").join("user").alias("user").on("user.id","apply.user_id").generateVoCode();
        } catch (IOException e) {
            e.printStackTrace();
        } catch (SQLException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

}
